/**
 * 
 */
package com.quiz.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.flurry.android.FlurryAgent;
import com.quiz.activity.util.QuizUtil;


/**
 *
 * @author Brian Boyle
 * Apr 23, 2012
 */
public class ContactActivity extends Activity {

    private TextView subject;
    private EditText comments;

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FlurryAgent.onStartSession(this, QuizUtil.FLURRY_KEY);

        setContentView(R.layout.contact);

        TextView contactHeader = (TextView) findViewById(R.id.contactHeader);
        QuizUtil.setMafiaFont(contactHeader, 48, getAssets());

        subject = (TextView) findViewById(R.id.subject);
        comments = (EditText) findViewById(R.id.comments);

        Button sendButton = (Button) findViewById(R.id.sendButton);
        sendButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

                emailIntent.setType("plain/text");
                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "sopranosquiz@gmail.com" });
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "" + subject.getText());
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, comments.getText());
                startActivity(Intent.createChooser(emailIntent, "Send mail..."));

            }
        });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onStop() {
        super.onStop();
        FlurryAgent.onEndSession(this);
    }
}
